import java.net.*;
import java.io.*;
import java.util.*;

public class SrvTest {
    static public void main(String [] args) throws Exception {
        ServerSocket sd = new ServerSocket(9188, 5);
        Socket cli = null;
        SocketAddress info = null;
        InputStream is = null;
        byte [] data = new byte[1024];
        while (true) {
            cli = sd.accept();
            if (cli == null)
                continue;
            info = cli.getRemoteSocketAddress();
            System.out.printf("客户端连接: %s\n", info);
            is = cli.getInputStream();
            Arrays.fill(data, (byte)0);
            is.read(data);
            System.out.println("客户端的请求: " + new String(data));
            cli.close();
        }
    }
}
